package com.liang.threadpool;

import java.util.concurrent.*;

public class ThreadPoolExecutorDemo {
    public static void main(String[] args) {
        ThreadPoolExecutor pool= new ThreadPoolExecutor(2, 5, 2, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(10),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());

        for (int i = 1; i <= 15; i++) {
            pool.submit(()->{
                System.out.println(Thread.currentThread().getName()+"正在执行");
            });

        }
        pool.shutdown();

    }
}
